<section class="group">
    <header class="group__header">
        <h2 class="group__title">
            <?= protect($group->name) ?>
        </h2>

        <div class="group__separator"></div>

        <button
            class="button--small button--ghost no-mobile"
            type="button"
            data-controller="modal-opener"
            data-action="modal-opener#fetch"
            data-modal-opener-href-value="<?= url('edit group', ['id' => $group->id, 'from' => $from]) ?>"
            aria-haspopup="dialog"
            aria-controls="modal"
        >
            <?= icon('pencil') ?>
            <?= _('Edit') ?>
        </button>

        <button
            class="button--smaller button--ghost only-mobile"
            type="button"
            data-controller="modal-opener"
            data-action="modal-opener#fetch"
            data-modal-opener-href-value="<?= url('edit group', ['id' => $group->id, 'from' => $from]) ?>"
            aria-haspopup="dialog"
            aria-controls="modal"
        >
            <?= icon('pencil') ?>
            <span class="sr-only">
                <?= _('Edit') ?>
            </span>
        </button>
    </header>

    <?php if ($collections): ?>
        <div class="cards">
            <?php foreach ($collections as $collection): ?>
                <?= $this->include('collections/_collection.phtml', [
                    'collection' => $collection,
                    'display_by' => $display_by,
                    'display_number_links' => $display_number_links,
                    'display_visibility' => $display_visibility && $collection->is_public,
                ]) ?>
            <?php endforeach; ?>

            <?php for ($i = 0; $i < (3 - (count($collections) % 3)); $i++): ?>
                <div class="card card--shadow no-mobile"></div>
            <?php endfor; ?>
        </div>
    <?php endif; ?>
</section>
